import com.zaxxer.hikari.HikariDataSource;

import java.sql.SQLException;

public class Hello {
    public static void main(String[] args) {
        HikariDataSource dataSource = new HikariDataSource();
        dataSource.setJdbcUrl("jdbc:mysql://127.0.0.1:3306/jdbc?characterEncoding=utf-8");
        dataSource.setUsername("root");
        dataSource.setPassword("Yan411328");
        dataSource.setDriverClassName("com.mysql.jdbc.Driver");
        try {
            if(dataSource.getConnection()!=null)
            {System.out.println("连接成功");}
            else {
                System.out.println("连接失败");
            }
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }
}